package com.xdl.flytest.service;

import com.xdl.flytest.bean.Environment;
import com.xdl.flytest.dao.EnvironmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: 80736
 * @Date: 2019/1/4 20:28
 * @Description:
 */
@Service
public class EnvironmentService {

    @Autowired
    private EnvironmentMapper environmentMapper;


    public List<Environment> getEnvironments() {
        return environmentMapper.selectAll();
    }

    public void addEnv(Environment environment) {
        environmentMapper.insertSelective(environment);
    }

    public Environment getEnvironmentById(Integer envId) {
        return environmentMapper.selectByPrimaryKey(envId);
    }

    public void updateEnv(Environment environment) {
        environmentMapper.updateByPrimaryKeySelective(environment);
    }

    public void deleteEnvById(Integer envId) {
        environmentMapper.deleteByPrimaryKey(envId);
    }
}
